package cn.laixueit.controller;

import cn.laixueit.exception.StudentException;
import cn.laixueit.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Controller
public class StudentController {

    @Autowired
    private StudentService studentService;

    @GetMapping("/findById")
    public String index(Integer id){
        Map<String, Object> map = studentService.findById(id);
        System.out.println(map);
        return "index";
    }

    @GetMapping("/selectAll")
    @ResponseBody
    public Integer selectAll()  {
        studentService.selectAll();
        return 200;
    }
}
